import { cloudmusic } from '@/utils/request_outside'

// 实例：根据传入类型返回不同内容
// 详情看下访注释部分
// 实时天气
// location: 101280109 (广州)
// key: fa44c8b1e7f84860a7613da210a44cc4
export function cloudMusicLogin(params) {
  return cloudmusic({
    url:'/login/cellphone',
    method: 'get',
    params
  })
}

export function cloudMusicList(params) {
  return cloudmusic({
    url:'/user/playlist',
    method: 'get',
    params
  })
}

// 获取歌单信息
export function cloudMusicGetListInfo(params) {
  return cloudmusic({
    url:'/playlist/track/all',
    method: 'get',
    params
  })
}

// 获取音乐url
export function cloudMusicGetMusicUrl(params) {
  // 如果获取为403 ↓
  //  https://music.163.com/song/media/outer/url?id=id.mp3 以 src 赋予 Audio 即可播放
  // /song/url/v1?id=33894312&level=exhigh
  return cloudmusic({
    url:'/song/url/v1',
    method: 'get',
    params
  })
}

// 刷新登陆状态
export function cloudMusicRefresh(params) {
  return cloudmusic({
    url:'/login/refresh',
    method: 'get',
    params
  })
}

// 是否登录
export function cloudMusicIsLogin(params) {
  return cloudmusic({
    url:'/login/status',
    method: 'get',
    params
  })
}

// 注销
export function cloudMusicLogout(params) {
  return cloudmusic({
    url:'/logout',
    method: 'get',
    params
  })
}
